%by clq
%2021/6/12
function[i_R,profits_R]=RoundRobin(I,J,j_all)
addpath functions;
n=size(j_all,2);

profits_R = zeros(100, n);
for ii = 1 : 100
    disp(ii);
    S=zeros(I,J);
    for i=1:n
        i_R(i)=mod(i-1,I)+1;
        
        j=j_all(i);
        S(i_R(i),j)=S(i_R(i),j)+1;
        Q = findQ(S); 
        R = findR(Q);
        profits_R(ii, i)=function_fQR(Q,R);
    end
end

profits_R = mean(profits_R, 1)



